﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using Peekaboo2008.model;
using Peekaboo2008.util;

namespace Peekaboo2008.dao
{
    class LoaiCongNoDAO
    {
        public static DataTable getAll()
        {
            return DataUtil.executeStore("sp_LoaiCongNo_GetAll", null);        
        }
        public static Boolean InsertLoaiCongNo(LoaiCongNoModel loaiCongNoModel)
        {
            SqlParameter[] param = new SqlParameter[2];
            param[0] = new SqlParameter("Ten", SqlDbType.NVarChar);
            param[0].Value = loaiCongNoModel.Ten;
            param[1] = new SqlParameter("Ghi_chu", SqlDbType.NVarChar);
            param[1].Value = loaiCongNoModel.Ghi_chu;

            return DataUtil.executeNonStore("sp_LoaiCongNo_Insert", param);
        }
        public static Boolean UpdateLoaiCongNo(LoaiCongNoModel loaiCongNoModel)
        {
            SqlParameter[] param = new SqlParameter[3];
            param[0] = new SqlParameter("Ten", SqlDbType.NVarChar);
            param[0].Value = loaiCongNoModel.Ten;
            param[1] = new SqlParameter("Ghi_chu", SqlDbType.NVarChar);
            param[1].Value = loaiCongNoModel.Ghi_chu;
            param[2] = new SqlParameter("ID", SqlDbType.Int);
            param[2].Value = loaiCongNoModel.ID;
            return DataUtil.executeNonStore("sp_LoaiCongNo_Update", param);
        }
    }
}
